package com.justnow.offer;

import java.util.HashSet;
import java.util.Scanner;

/**
 * @author justnow
 * Created on 2020-09-13
 * Description
 */
public class Aiqiyi01 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        HashSet<Character> hashset = new HashSet<>();
        int left = 0, right = 0, max = 0;
        String str = scanner.nextLine();
        while (right < str.length()) {
            while (hashset.contains(str.charAt(right))) {
                hashset.remove(str.charAt(left));
                left++;
            }
            hashset.add(str.charAt(right));
            right++;
            max = Math.max(right - left, max);
        }
        System.out.println(max);
    }
}
